<?php

    include '../../Include/IncludeLogin.php';

    $plantillaP = new Panel( "../View/Html/Plantilla.html" );
    $plantillaEC = new Panel( "../View/Html/Encabezado.html" );
    $plantillaEC->add( "TITULO" , "Lista de Clientes" );
    $plantillaEC->add( $_SESSION );
    $plantillaEC->add( "RUTA", "../../Doc/Ayuda en linea/cliente_datos.html" );

    if ( $_SESSION['USR_PRIVILEGIO'] == 'ADMIN' ){
        $plantillaPrivilegio = new Panel( "../View/Html/MenuPrivilegio.html" );
        $plantillaEC->add( "MENU_PRIVILEGIO" , $plantillaPrivilegio );
    }

    $plantillaP->add( "ENCABEZADO" , $plantillaEC );
    $plantillaCON = new Panel( "../View/Html/ListaCliente.html" );

    $hBlock = $plantillaCON->setBlock( "BLQ_CLT_INFO" );

     try {
                $clienteLogica = FabricaComando::crearListaCliente();
                $listaCliente = $clienteLogica->hacer();
            } catch ( ClienteLogicaException $Ex ) {
                new ExceptionHandler( $Ex );
            }

    foreach ( $listaCliente as $cliente ){
        $plantillaCON->add( $cliente->toArray() );
        $plantillaCON->concat($hBlock);

    }

    $plantillaP->add( "CONTENIDO" , $plantillaCON );
    $plantillaPIE = new Panel( "../View/Html/Pie.html" );
    $plantillaP->add( "PIE" , $plantillaPIE );
    $plantillaP->show();

?>